<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../../own/lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="../../../own/css/public.css" media="all">
    <style>
        body {
            background-color: #ffffff;
        }
    </style>
</head>
<body>
<div class="layuimini-main">

    <div class="layui-form layuimini-form" lay-filter="updateSubmit">
        <input type="hidden" name="id">
        <div class="layui-form-item">
            <label class="layui-form-label required">车位号</label>
            <div class="layui-input-block">
                <input type="text" name="carnum" lay-verify="required" lay-reqtext="不能为空"
                       placeholder="请输入车位编号" value="" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label required">业主</label>
            <div class="layui-input-block">
                <input type="text" name="caruser" lay-verify="required" lay-reqtext="不能为空"
                       placeholder="请输入业主" value="" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">开始时间</label>
            <div class="layui-inline">
                <input type="date" name="starttime" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">结束时间</label>
            <div class="layui-inline">
                <input type="date" name="endtime" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label required">金额</label>
            <div class="layui-inline">
                <input type="text" name="money" lay-verify="required" lay-reqtext="不能为空"
                       placeholder="请输入金额" value="" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item" >
            <label class="layui-form-label required">缴费状态</label>
            <div class="layui-inline">
                <input type="text" name="status" lay-verify="required" lay-reqtext="不能为空"
                       placeholder="缴费状态" value="" class="layui-input">
            </div>
            <!--            <div class="layui-inline" >-->
            <!--                <select name="status"  id="status">-->
            <!--                    <option value="">请选择</option>-->
            <!--                    <option value="1">已缴费</option>-->
            <!--                    <option value="0">未缴费</option>-->
            <!--                </select>-->
            <!--            </div>-->
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">确认保存</button>
            </div>
        </div>
    </div>
</div>
<script src="../../../own/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script>
    layui.use(['form'], function () {
        var form = layui.form,
            layer = layui.layer,
            $ = layui.$;

        //监听提交
        form.on('submit(saveBtn)', function (data) {
            let user = JSON.stringify(data.field);
            console.log(user)
            $.post('/user?method=addCarInfo',{user},function (res) {
                if (res.code == 200){
                    layer.msg(res.msg,function (){
                        var iframeIndex=parent.layer.getFrameIndex(window.name);
                        parent.layer.close(iframeIndex);
                        parent.window.location.reload();

                    })
                }else {
                    layer.msg(res.msg,{icon:2})
                }
            },'JSON')
            return false;
        });

    });

    // layui.use(['form', 'table','laydate'], function () {
    //     var form = layui.form,
    //         layer = layui.layer,
    //         table = layui.table,
    //         laydate=layui.laydate,
    //         $ = layui.$;
    //
    //     // 日期
    //     // laydate.render({
    //     //     elem: '#date',
    //     //     trigger:'click'
    //     // });
    //     form.render();
    //     //查询所有的楼宇信息并渲染到select中
    //     $.get("owner/queryAll",{},function (data) {
    //         var list=data;
    //         var select =document.getElementById("typeId");
    //         if(list!=null || list.size()>0){
    //             for(var c in list){
    //                 var option=document.createElement("option");
    //                 option.setAttribute("value",list[c].id);
    //                 option.innerText=list[c].username;
    //                 select.appendChild(option);
    //             }
    //         }
    //         form.render('select');
    //     },"json");
    //
    //
    //
    //     // 当前弹出层，防止ID被覆盖
    //     var parentIndex = layer.index;
    //
    //     //监听提交
    //     form.on('submit(saveBtn)', function (data) {
    //         //获取表单中的数据信息
    //         var datas=data.field;
    //         UpdateSubmit($,"parking/add",datas);
    //         return false;
    //     });
    //
    // });
</script>
</body>
</html>